<template>
    <!-- <h1>home page</h1>
  </div> --> 
  <div class="page-home">
    <!-- <div class="phone">
      <div class="left-phone">
        <img src="./static/img/phone/phone_1.png" alt="" >
      </div>
      <div class="right-phone">
        <img src="" alt="" >
      </div>
    </div>  -->
    <ul class="types1">
      <router-link :to="'/' + item.id" tag="li" v-for="item in types" :key="item.id">
      <div class="box1">
        <div class="img1">
          <img :src="'./static/img/phone/' + item.img" alt="" height="290px">
        </div>
        <div class="img2">
          <img :src="'./static/img/phone' + item.img" alt="" >
        </div>
      </div>
      <div class="box2">
        <p class="open">{{item.open}}</p>
        <p class="yyb">{{item.yyb}}
          <img class="yyb2" src="">
        </p>
        
        <!-- <img :src="'./static/img/phone' + item.img" alt="" width="20px"> -->
      </div>
      </router-link>
    </ul>
    <p class="title_1">热门作品推荐</p>
    <!-- <ul class="types">
      <router-link :to="'/' + item.id" tag="li" v-for="item in types" :key="item.id">
      <img :src="'./static/img/icon/' + item.img" alt="" class="imgs">
      <div class="box">

        <p class="title_2">{{item.title}}</p>
        <img :src="'./static/img/icon' + item.imgs" alt="" class="listen">
        <p class="num">{{item.num}}</p>
      </div>
      </router-link>
    </ul> -->
    <ul class="types">
      <router-link :to="'/' + list.id" tag="li" v-for="list in list" :key="list.id">
      <img :src="list.url" alt="" class="imgs">
      <div class="box">

        <p class="title_2">{{list.title}}</p>
        <!-- <img :src="'./static/img/icon' + item.imgs" alt="" class="listen"> -->
        <img :src="list.img" alt="" class="listen">
        <p class="num">{{list.num}}</p>
      </div>
      </router-link>
    </ul>
    <!-- K歌明星 -->
    <p class="title_1">K歌明星</p>
    <ul class="ads">
      <router-link tag="li" to="" v-for="(item) in item" :key="item._id">
        <img :src="item.url" alt="">
        <h3>{{ item.names}}</h3>
      </router-link>
    </ul>
  </div>
</template>
<style lang="less" scoped>
.page-home {
  .types1{
    width: 375px;
    height: 667px;
    background-color: greenyellow;
    position: relative;
    .box1{
      width: 100%;
      height: 293px;
      padding-top: 100px;
      position: absolute;
    }
    .box2{
      position: absolute;
      bottom: 150px;
      left: 85px;
      height: 50px;
      width:200px ;
      text-align: center;
    }
    .open{
      display: block;
      height: 45px;
      margin: 0 auto;
      border: 1px solid #fff;
      border-radius: 45px;
      font-size: 24px;
      line-height: 45px;
      text-align: center;
      color: #fff;
    }
    .yyb{
      margin-top: 15px;
      margin-left:-50px;
    }
    .yyb2{
      display: inline-block;
      // position: absolute;
      width: 53px;
      height: 21px;
      border: hotpink solid 2px;
    }
  }
  .title_1{
    padding: 10px;
  }
  .types{
    display:flex;
    flex-wrap: wrap;
    font-size: 14px;
    li{
    position: relative;

    }
    .imgs{
      width: 172.5px;
      height: 172.5px;
      padding: 7px;
    }
    .box{
      position: absolute;
      // left:10px;
      bottom:4px;
      margin: 7px;
      padding: 7px;
      width: 159px;
      color: #fff;
      // height:30px;
      background: rgba(0, 0, 0, 0.712);
      // display: -webkit-box;
      // display: flex;
      // justify-content: space-between;
      // float:left;
      .listen{
        height: 20px;
        width: 20px;
        position: absolute;
        top: 8px;
        right: 35px;
        margin-right:10px;
      }
      .num{
        position: absolute;
        top: 8px;
        right: 5px;
        // margin-left: 10px;
      }
    }
  }
  .ads{
    background-color:#fff;
    margin-top:10px;
    display:flex;
    flex-wrap: wrap;
    font-size:12px;
    text-align: center;
    li{
      width:33%;
      // flex:1;
      margin-top: 20px;
      img{
        border-radius: 50px;
      }
    }
  }
}
</style>
<script>
export default {
  //同步数据
  data() {
    return {
      types: [
        {id:0, img:'phone_2.png'},
        {id:1, img:'phone_1.png'},
        {id:2, open:"立即下载"},
        {id:3, yyb:"应用宝联合独家首发"},
        // {id:1, img:'02.jpg',title:"初雪的谎言",num:'2W+'},
        // {id:2, img:'03.jpg',title:"酒梦",num:'3473'},

        // {id:3, img:'04.jpg',title:"至少还有你",num:'2W+'},

        // {id:4, img:'05.jpg',title:"关于你的心事",num:'1W+'},
        // {id:5, img:'06.jpg',title:"城里的月光",num:'7624'},
        // {id:6, img:'07.jpg',title:"乱心",num:'3W+'},
        // {id:7, img:'08.jpg',title:"光阴的故事",num:'9W+'}
      ],
      //避免数据丢失，将数据初始化
      list:[],
      item:[]
    }
  },
  //组件创建前
  created() {
    //获取数据
    this.$http
      .get('/data/home')
      //监听数据返回
      // .then(res => console.log(res))
      //解构data
      .then(({ data }) => {
        //存储数据
        this.list = data.list,
        this.item = data.item
      })
  },
  // data(){
  //   return{
  //     Img:{
  //       backgroundImage:"url("+ require('./static/img/phone/yyb.png')+")"
  //     }
  //   }
  // }
}
</script>
